

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>登录</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="layuiadmin/style/admin.css" media="all">
  <link rel="stylesheet" href="layuiadmin/style/login.css" media="all">

  <!--框架样式-->
  <link href="slidingValidation/css/bootstrap.min.css" rel="stylesheet">

  <!--图标样式-->
  <link href="slidingValidation/css/font-awesome.min.css" rel="stylesheet">

  <!--主要样式-->
  <link href="slidingValidation/disk/slidercaptcha.css" rel="stylesheet" />
  <style>
    body{
      background-color: #d2d2d2;

    }
    .slidercaptcha {
      margin: 0 auto;
      width: 314px;
      height: 286px;
      border-radius: 4px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.125);
      margin-top: 40px;
    }

    .slidercaptcha .card-body {
      padding: 1rem;
    }

    .slidercaptcha canvas:first-child {
      border-radius: 4px;
      border: 1px solid #e6e8eb;
    }

    .slidercaptcha.card .card-header {
      background-image: none;
      background-color: rgba(0, 0, 0, 0.03);
    }

    .refreshIcon {
      top: -54px;
    }


  </style>

</head>
<body>

  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <h2>开放平台管理系统</h2>
        <p>请登录</p>
      </div>
      <form id="form">
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
          <div class="layui-form-item">
            <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
            <input type="text" name="username" id="LAY-user-login-username" autocomplete="off" lay-verify="required" placeholder="用户名" class="layui-input">
          </div>
          <div class="layui-form-item">
            <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
            <input type="password" name="password" id="LAY-user-login-password" autocomplete="off"  lay-verify="required" placeholder="密码" class="layui-input">
          </div>
<!--          <div class="layui-form-item" style="margin-bottom: 20px;">-->
<!--            <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">-->
<!--&lt;!&ndash;            <a href="forget.html" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>&ndash;&gt;-->
<!--          </div>-->
          <div class="layui-form-item">
            <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
          </div>
          <!--        <div class="layui-trans layui-form-item layadmin-user-login-other">-->
          <!--          <label>社交账号登入</label>-->
          <!--          <a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>-->
          <!--          <a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>-->
          <!--          <a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>-->
          <!--          -->
          <!--          <a href="reg.html" class="layadmin-user-jump-change layadmin-link">注册帐号</a>-->
          <!--        </div>-->
        </div>
      </form>
    </div>

    <div class="layui-trans layadmin-user-login-footer">

      <p>© 2020 开放平台管理系统</a></p>

    </div>

    <!--<div class="ladmin-user-login-theme">
      <script type="text/html" template>
        <ul>
          <li data-theme=""><img src="{{ layui.setter.base }}style/res/bg-none.jpg"></li>
          <li data-theme="#03152A" style="background-color: #03152A;"></li>
          <li data-theme="#2E241B" style="background-color: #2E241B;"></li>
          <li data-theme="#50314F" style="background-color: #50314F;"></li>
          <li data-theme="#344058" style="background-color: #344058;"></li>
          <li data-theme="#20222A" style="background-color: #20222A;"></li>
        </ul>
      </script>
    </div>-->

  </div>

  <script src="layuiadmin/layui/layui.js"></script>
  <script>
  layui.config({
    base: '/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'user'], function(){
    var $ = layui.$
    ,setter = layui.setter
    ,admin = layui.admin
    ,form = layui.form
    ,router = layui.router()
    ,search = router.search;

    form.render();

    function checkLogin(){
      
    }
    //提交
    form.on('submit(LAY-user-login-submit)', function(obj){

      layer.open({
        type: 1,
        // area: ['50%', '50%'],
         area: ['350px', '350px'],
        title: false,
        content: $('#slidercaptcha').text(),//这里content是一个普通的String
      });
      //alert('aaa');
      $('#captcha').sliderCaptcha({


        onSuccess: function (index) {
          var loginItem = $('#form').serializeJSON();
          //alert(JSON.stringify(loginItem));
          //滑动验证成功，开始ajax请求
          $.ajax({
            //请求方式
            type : "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url : "/admin/login",
            //数据，json字符串
            data : JSON.stringify(loginItem),
            dataType: "json",
            //请求成功
            success : function(data) {
              if(!data.status){
                layer.msg(data.message);
                setTimeout(
                        function()
                        {
                          layer.closeAll();
                          $("#LAY-user-login-username").val("");
                          $("#LAY-user-login-password").val("");
                        }, 2000);
              }else{
                layer.closeAll();
                layer.msg('登录成功,欢迎回来：'+data.message.nickname, {
                  icon: 1
                });
                setTimeout(
                        function()
                        {
                          layer.msg('即将跳转到管理页面');
                        }, 2000);
                setTimeout(
                        function()
                        {
                          location.href = "/index.html";
                        }, 4500);
              }
            },
            //请求失败，包含具体的错误信息
            error : function(data){
            }
          });
        }

      });
      return false;
    });
    // 关闭
    function closeLoad(index) {
      layer.close(index);

    }
  });
  </script>

<script type="text/html" id="slidercaptcha">
  <div class="slidercaptcha card">
    <div class="card-body"><div id="captcha"></div></div>
  </div>
</script>
  <script src="slidingValidation/js/jquery-1.11.0.min.js" type="text/javascript"></script>
  <script src="js/jquery.serializejson.min.js"></script>
  <script src="slidingValidation/disk/longbow.slidercaptcha.js"></script>

</body>
</html>